Does anyone have experience using the DOORS dictionary? I am trying to highlight the spelling errors in a given requirements specification in the form of a list view. I cycle words in an object making sure that it is in the dictionary. I can run the script two times without any errors however, at every subsequent attempt after the second attempt the script fails since I am unable to open the dictionary correctly. Here is the method snippet {code}
Dictionary d
d = null
string openStatus = open(d, databaseDictionary)
println("openStatus: " openStatus "")
buf_dicto = create()
for buf_dicto in d do {
if(stringOf(buf_dicto) == word_to_find)
{
close(d, false, true)
return true
}
}
close(d, false, true)
{code}
The first two times I the openStatus variable is blank and the dictionary is opened correctly and life is great. However, all other attempts after the second give me an openStatus of :
openStatus: Failed to initialise database dictionary
This leads to a crash which I would really like to fix. Is this the kind of problem that is undocumented and which IBM never fixed (would not be the first time)? Any help would be appreciated
Thanks in advance
PatrickGuay - Mon Jan 06 12:05:14 EST 2014 |
Re: Cannot initialize the DOORS Dictionary correctly Never used the "Dictionary" sorry. [1] But it sure seems to me wrong ..err.. ineffecient to open and close the dictionary for each word you check. It FEELS to me like this is the root cause of your problem. [2] the buffer create just creates a wasted allocated unit; since the create handle is lost in the subsequent loop. "Buffer buf_dicto = null" is sufficient. [3] "tempStringOf(buf_dicto)" is slightly better than "stringOf". OK, so this is the first time I've looked at "Dictionary". Seems like it would be drastically faster to read all the Buffers in the dictionary and build a global Skip List of all the words; then see if your word is in the Skip list. Plowing linearly through 10s1000s of Buffers seems hopeless; but that is what they would have you do. -Louie |
Re: Cannot initialize the DOORS Dictionary correctly I've found a workaround to my problem which is inline with what you are suggesting. I was opening and closing the dictionary in a loop. It worked fine for the first couple of executions but would fail rather quickly. My fix is to open the dictionary in a method I call firstPass() which is an initialization method called at the very start of main. I only close the dictionary in my close_callback method() which destroys the dialog box. The dictionary works so-so well but it seems that telelogic didn't push the concept far enough. Another corner-of-the-table feature. |